<?php
class BaseConfigController extends ConfigAppController
{
	var $name = 'BaseConfig';
	var $userModelAlias = 'BaseConfig';
	
	function _getBaseConfigModel()
	{
		return $this->{$this->configModelAlias};
	}
	
	function admin_setting($modelName = null)
	{
		$configModelName = $modelName.'Config'; 
		if(empty($modelName))
		{
			$this->errorMsg(__('Invalid URL!'));
			$this->redirect(Configure::read('Backend.adminLoginRedirect'));
		}

		if(!empty($this->data))
		{
			if($this->_getBaseConfigModel()->save($this->data))
			{
				$this->successMsg(sprintf(__('%s configuration has been updated.'),__($modelName)));
			}else
			{
				$this->errorMsg(sprintf(__('Sorry, %s configuration could not be updated.'),__($modelName)));
			}
		}else
		{		
			$this->data = $this->$configModelName->getKeyValuePairs();
		}
		$this->set('configModelName',$configModelName);		
	}
} 
?>